<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>分页</title>
</head>
<body>
<ul>
    {% for area in page %}
    <li>{{ area.atitle }}</li>
    {% endfor %}
</ul>
{% if page.has_previous  %} {# 判断是否有上一页 #}
    <a href="/show_area{{ page.previous_page_number }}">上一页</a>
{% endif %}
    {% for pindex in page.paginator.page_range %} {# 遍历数值 #}
        {% if pindex == page.number %}{# 返回当前页码做判断 #}
            {{ pindex }}
        {% else %}
            <a href="/show_area{{ pindex }}">{{ pindex }}</a>
        {% endif %}
    {% endfor %}
{% if page.has_next %}
<a href="show_area{{ page.next_page_number }}">下一页</a>
{% endif %}

</body>
</html>